#ifndef PRIMITIVE_H
#define PRIMITIVE_H

#include "ray.h"

#define COS_45_2 0.5
#define SEN_45_2 0.5
#define CONE_1_BASE_2 4	// 2*tg 45 ^2

// Possible primitive types
typedef enum { INVALID_PRIMITIVE, SPHERE, CYLINDER, CONE, CUBE } PrimitiveType;

class Primitive
{
public:
   Primitive();
   virtual bool ray_collision(Ray r) = 0;
   // Shouldnt be here
//   glm::vec4 m_collision_point;
   float t[2];
   glm::vec4 normal[2];
//   glm::vec4 m_point_normal;
   glm::vec4 m_origin;
};

class Sphere : public Primitive
{
public:
   Sphere();
   virtual bool ray_collision(Ray r);
   float m_radius;
private:
};

class Cylinder : public Primitive
{
public:
    Cylinder();
    bool ray_collision(Ray r);
    bool collide(Ray r);
    glm::vec4 m_collision_point;
    glm::vec4 m_collision_normal;

private:
    glm::vec4 m_origin;
    glm::vec4 m_bottom_point;
    glm::vec4 m_top_point;
    float m_radius;
    float m_height;
};

class Cone : public Primitive
{
public:
   Cone();
   glm::vec4 m_origin;
   float m_base_radius;
   float m_height;
   bool ray_collision(Ray r);
};

class Cube : public Primitive
{
public:
    Cube();
    bool ray_collision(Ray r);
    bool collide(Ray r);
    bool check_point_collision(glm::vec4 point);
    float m_width;
    float m_height;
    float m_depth;
    glm::vec4 m_collision_point;
    glm::vec4 m_collision_normal;
    glm::vec4 m_origin;
    glm::vec4 m_left_point;
    glm::vec4 m_right_point;
    glm::vec4 m_top_point;
    glm::vec4 m_front_point;
    glm::vec4 m_back_point;
    glm::vec4 m_bottom_point;

};

#endif // PRIMITIVE_H
